package com.lj.web.controller;

import javax.annotation.Resource; 
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller; 
import org.springframework.ui.ModelMap; 
import org.springframework.web.bind.annotation.RequestMapping;

import com.lj.web.bean.LoginInfo;
import com.lj.web.business.AddLoginInfo;

@Controller
@RequestMapping("/result.do")
public class ResultController {
	//将spring 配置文件中的bean 通过setter注入进来 
    @Resource(name="TestBusiness") 
    private AddLoginInfo ali=null;
    public void setTestBusiness(AddLoginInfo ali) { 
        this.ali = ali; 
    }
    @RequestMapping 
    public String viewUser(HttpServletRequest request, ModelMap modelMap) 
            throws Exception {
    	LoginInfo li=new LoginInfo();
    	li.setLoginName(request.getParameter("username"));
    	li.setLoginAgent(request.getHeader("User-Agent"));
    	li.setLoginIp(request.getLocalAddr());
    	li.setLoginSession(request.getSession().getId());
        ali.add(li); 
        return "result"; 
    } 

}
